<%--
 *  File:    SalesBehaviour.jsp
 *  @Author: banshang
 *  Date:    2010/04/21
 *
 *  Copyright (C) 2000 - 2002 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>
<%@ page import="com.oval.util.*" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>


<% //--------------------------------------  setting logger --%>


<% //--------------------------------------  variant and initialization --%>
<%
	String strModuleName = "CM";
  String privilegeCode = "R60010"; 
    String contextPath = request.getContextPath(); 
%>

<% //--------------------------------------  include files list --%>

<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/FrmDefault.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>

<html>
<head>
<title>SalesBehaviour</title>
<PageFlow:CheckPageFlow pageName="p_dtpurchasesalesinvreport"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath %>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath %>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/FuncLib.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/ScriptLib.js"></script>

<%@ include file="/inc/SummaryDivision.inc" %>
<%  
	java.util.Calendar cal = java.util.Calendar.getInstance();  
	String year = cal.get(Calendar.YEAR)+"";     
	String month = cal.get(Calendar.MONTH)+"";
	if(cal.get(Calendar.MONTH) == 0){
	month = "12";
	year = (cal.get(Calendar.YEAR)-1)+"";
	}  

%>
<script language="JavaScript" >

function changeMonthDisplay(){
	var frequency = document.cform.frequency.value;
	var monthSelect = document.getElementById('monthSelect');
	if(frequency == 20 || frequency == 60 || frequency == 70){
		monthSelect.style.display='inline';
	}else{
		monthSelect.style.display='none';
	}
}

function page_go(){
	var year = document.cform.year.value;
	var url; 
	var frequency = document.cform.frequency.value;
	var regionid=cform.regionid.value;
	var orgid=cform.customerid.value;
	var userids=cform.userids.value;
	url= "MonthlyDataFileReport.jsp?<%= OvalTools.randomURL() %>&frequency="+frequency+"&year="+year+"&regionid="+regionid+"&orgid="+orgid+"&userids="+userids; 
	var style = "height=800, width=1200, top=100, left=100, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no";
	window.open (url, 'newwindow', style);
}

function popCustomer() {
	  opt = "customer";
	  var status = "height=450, width=600, top=100, left=100, toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no";
			var url = "<%=contextPath%>/tdr/dataconfirm/PathOrgSelect.jsp?o_thread=" + Math.random();
			url += "&globalpccode=99,112,117";
			
			if (typeof popwindow != 'undefined') popwindow.close();
			popwindow = window.open(url, "newwindow", status);
	}
	
	
function page_setOrg(id, name, code) {
	if(opt == "dealer"){
	  	cform.dealerid.value=id;
	  	cform.dealercode.value = code;
	  	cform.dealername.value = name;
	  }
	  if(opt == "customer"){
	  	cform.customerid.value=id;
	  	cform.customercode.value = code;
	  	cform.customername.value = name;
	  }	
	  opt = "";
	  if (popwindow != null)
	    popwindow.close();
}
function popRep() {
	var regionid=cform.regionid.value;
	var status = "height=400, width=600, top=100, left=100, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no";
	var url = "<%=contextPath%>/tdr/dataverify/SalesPopWindow.jsp?<%= OvalTools.randomURL() %>&regionid="+regionid;
	popwindow = window.open(url, "newwindow", status);
  }

function SetSalesMan(id,code,name){
	cform.userids.value=id;
	cform.employeecode.value=code;
	cform.employeename.value=name;
}
</script>

</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form name="cform" method="post" action="<%=contextPath %>/Dispatcher">
<input type="hidden" name="actionname">
<custom:hidden name="userinfo" property="username" scope="session"/>
<%@ include file="/inc/PageLocation.inc" %>



<table width="100%" cellspacing="0" border="0" cellpadding="0" style=" background:url(../images/cn/title_2_bg.jpg) repeat-x; " height="36">
	<tr>
		<td width="950px;">
			<font color="red">数据类型:</font>
			<custom:selectdic property="frequency" dictType="DataCleanType" valueCriteria="10,20,30"/>
			&nbsp;&nbsp;
			<%= label.getLabelName("L_YearF") %><%= label.getLabelName("L_Colon") %>
			<custom:selectdic property="year" dictType="Years" command="notnull" value="<%=year %>" label="L_Year1"/>
			&nbsp;&nbsp;
			<span id="monthSelect" style="display:none;">
			<%= label.getLabelName("L_Month") %><%= label.getLabelName("L_Colon") %>
			<custom:selectdic property="month" dictType="Months" command="notnull" label="L_Month"/>
			</span>&nbsp;&nbsp;
			<%= label.getLabelName("L_Businessarea") + label.getLabelName("L_Colon") %>
			<custom:select optionInnerTextKey="areaname" optionsName="areas" optionValueKey="areaid" property="regionid" defaultValue="ALL" defaultValueCost=""/>&nbsp;&nbsp;
			<%= "经销商" + label.getLabelName("L_Colon") %>
	         <custom:text property="customercode" size="8" readonly="true"/>
	        <a onclick="javascript:popCustomer();"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a>
	        <custom:text property="customername" readonly="true" size="25"/>
	        <custom:hidden property="customerid" />&nbsp;&nbsp;
			<%=label.getLabelName("L_BusinessContact") +  label.getLabelName("L_Colon") %>
			<custom:text property="employeename" size="20" readonly="true" style="border:1px #7F9DB9 solid;"/>
			<a onClick="javascript:popRep();"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a> 
			<custom:hidden property="userids"/>
			<custom:hidden property="employeecode"/></td>
			<td>
			<a href="javascript:page_go()"><img src="<%= contextPath %>/images/<%= strLanguageCode %>/go_fy.gif" border="0" style="border: 1 solid #000000"></a>&nbsp;&nbsp;<button type="reset" class="button1" name="re" value="clear"  style="width:60"><%=label.getLabelName("L_Clear") %>
		</td><td></td>
	</tr>
</table>

</form>
</body>
</html>